import { createSlice } from "@reduxjs/toolkit";
import { setToken, getToken } from '@/untils/auth'

const LoginStore = createSlice({
    name: 'login',
    initialState: {
        token: getToken(),
        avatar: '',
    },
    reducers: {
        setStateToken: (state, action) => {
            state.token = action.payload;
            setToken(action.payload);
        },
    }
});

const { setStateToken } = LoginStore.actions;
const reducer = LoginStore.reducer;



export { setStateToken };
export default reducer;
